package security.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "organization", schema = "security")
public class Organization {
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	private String name;
	@Column(unique = true)
	private Long code;
	private String alias;
	@Column(unique = true)
	private String domain;
	private String country;
	private String phone;
	@Temporal(TemporalType.TIMESTAMP)
	private Date creation;
	@Lob
	private byte[] logo;
	private Boolean enabled;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="organization")
	private List<Account> accounts;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="organization")
	private List<Dashboard> dashboards;
	
	@ManyToOne
	private Corporation corporation;
	
	
	private SystemSettings settings;
	

	public Organization() {
		super();
	}

	public Organization(String name, String alias, Long code, Boolean enabled) {
		super();
		this.name = name;
		this.alias = alias;
		this.code = code;
		this.enabled = enabled;
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Long getCode() {
		return code;
	}
	public void setCode(Long code) {
		this.code = code;
	}	
	public String getAlias() {
		return alias;
	}
	public void setAlias(String alias) {
		this.alias = alias;
	}
	public String getDomain() {
		return domain;
	}
	public void setDomain(String domain) {
		this.domain = domain;
	}
	public String getCountry() {
		return country;
	}
	public void setCountry(String country) {
		this.country = country;
	}
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public Date getCreation() {
		return creation;
	}
	public void setCreation(Date creation) {
		this.creation = creation;
	}
	public byte[] getLogo() {
		return logo;
	}
	public void setLogo(byte[] logo) {
		this.logo = logo;
	}
	public Boolean getEnabled() {
		return enabled;
	}
	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}	
	public List<Account> getAccounts() {
		return accounts;
	}
	public void setAccounts(List<Account> accounts) {
		this.accounts = accounts;
	}
	public List<Dashboard> getDashboards() {
		return dashboards;
	}
	public void setDashboards(List<Dashboard> dashboards) {
		this.dashboards = dashboards;
	}	
   
    public SystemSettings getSettings() {
        return settings;
    }   
    public void setSettings(SystemSettings settings) {
        this.settings = settings;
    }

	public Corporation getCorporation() {
		return corporation;
	}
	public void setCorporation(Corporation corporation) {
		this.corporation = corporation;
	}
    
	
}
